<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body></body>
</html>
<script>
  function getpagelistdata(a, b) {
    console.log("a,b", a, b);
  }
  if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(onSuccess, onError);
  } else {
    // alert("您的浏览器不支持使用HTML 5来获取地理位置服务");
    getpagelistdata("", "");
  }

  //定位数据获取成功响应
  function onSuccess(position) {
    var longitude = position.coords.longitude;
    var latitude = position.coords.latitude;
    console.log("longitude, latitude", longitude, latitude);
    getpagelistdata(longitude, latitude);
  }
  //定位数据获取失败响应
  function onError(error) {
    getpagelistdata("", "");
  }
</script>
